home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / c / appsource.lha / APlusPlus / TESTPRGS / utility / AttrList_test.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-20  |  1.9 KB  |  81 lines

  1. /*******************************************************************************
  2.  
  3.    taglist class
  4.    $id$
  5.  *******************************************************************************/
  6.  
  7. #include <iostream.h>
  8. #include <APlusPlus/utility/AttrList.h>
  9.  
  10. //--------------------------------------------------------------------------------------
  11.  
  12.  
  13. void WorkTaglist(AttrList& attrs)
  14. {
  15.    cout << "\tWorkTaglist" << endl;
  16.    AttrIterator next(attrs);
  17.  
  18.  
  19.    while (next())
  20.    {
  21.       //next.writeData(23);
  22.       cout << "\tTag = "<<next.tag()<<", Data = "<<next.data()<<endl;
  23.       //t = next.tag(); d = next.data();
  24.    }
  25.    cout << "\tWorkTaglist END\n";
  26. }
  27.  
  28.  
  29. void propagate(const AttrList& attrs)
  30. {
  31.    cout << "\tpropagate\n";
  32.    {struct TagItem *ti = attrs; cout << ti<<endl;
  33.         }
  34.    cout << "\tpropagate END\n";
  35. }
  36.  
  37. void UseTaglist(int p1,AttrList& attrs)
  38. {
  39.    cout << "\tUseTaglist(" << attrs << ")\n{\n";
  40.    AttrIterator next(attrs);
  41.    //AttrManipulator next(attrs);
  42.    //Tag t; LONG d;
  43.  
  44.    // for (int i=0; i<9999; i++)
  45.    {
  46.       while (next())
  47.       {
  48.          //next.writeData(0);
  49.          cout << "\tTag = "<<next.tag()<<", Data = "<<next.data()<<"  //  ";
  50.                   //t = next.tag(); d = next.data();
  51.       }
  52.       next.reset();
  53.    }
  54.    cout << "\ncall 'propagate(attrs)'\n";
  55.    propagate(attrs);
  56.    cout << "\tUseTaglist END\n}\n";
  57.  
  58. }
  59.  
  60. main()
  61. {
  62.    cout << "main: a1\n";
  63.    const AttrList a1(111,999,222,888,333,777,TAG_END);
  64.    cout << "main: a2\n";
  65.    AttrList a2(a1);
  66.  
  67.  
  68.    cout << "a1 = "<<a1<<endl;
  69.    cout << "a2 = "<<a2<<endl;
  70.    WorkTaglist((TAG_END));
  71.  
  72.    cout << "main: UseTaglist(0, AttrList(2,4,3,9,TAG_END));\n";
  73.    UseTaglist(1, AttrList(200,400,300,900,TAG_END) );
  74.    cout << "main: UseTaglist(1, AttrList(1,1,2,4,3,9,TAG_END));\n";
  75.    UseTaglist(1, AttrList(100,100,200,400,300,900,TAG_END) );
  76.  
  77.  
  78.    cout << "main: UseTaglist(0,a2);\n";
  79.    UseTaglist(1, a2);//(12,1,13,2,TAG_END));
  80. }
  81.